/**
 * 
 */
package com.netflexitysolutions.amazonws.sdb;

/**
 * @author netflexity
 *
 */
public class DefaultResponseCallback implements ResponseCallback{
	
	private int totalRecords;
	private Statistics lastStats;
	private Integer maxRecords;
	private String nextToken;
	
	/**
	 * Default
	 */
	public DefaultResponseCallback() {
	}

	/**
	 * @param maxRecords
	 */
	public DefaultResponseCallback(Integer maxRecords) {
		this(maxRecords, null);
	}

	/**
	 * @param nextToken
	 */
	public DefaultResponseCallback(String nextToken) {
		this(null, nextToken);
	}

	/**
	 * @param maxRecords
	 * @param nextToken
	 */
	public DefaultResponseCallback(Integer maxRecords, String nextToken) {
		this.maxRecords = maxRecords;
		this.nextToken = nextToken;
	}

	/* (non-Javadoc)
	 * @see com.netflexitysolutions.amazonws.sdb.ResponseCallback#getMaxRecords()
	 */
	public Integer getMaxRecords() {
		return maxRecords;
	}

	/* (non-Javadoc)
	 * @see com.netflexitysolutions.amazonws.sdb.ResponseCallback#getNextToken()
	 */
	public String getNextToken() {
		return nextToken;
	}

	/* (non-Javadoc)
	 * @see com.netflexitysolutions.amazonws.sdb.ResponseCallback#onResponse(com.netflexitysolutions.amazonws.sdb.Statistics)
	 */
	public void onResponse(Statistics stats) {
		this.lastStats = stats;
		totalRecords += stats.getRecordCount();
	}

	/**
	 * @return the totalRecords
	 */
	public int getTotalRecords() {
		return totalRecords;
	}

	/**
	 * @return the lastStats
	 */
	public Statistics getLastStats() {
		return lastStats;
	}
}
